package com.demo.job;

import lombok.extern.slf4j.Slf4j;
import org.noear.solon.extend.cron4j.Cron4j;
import org.noear.solon.socketd.SessionManager;

import java.time.LocalDateTime;

@Slf4j
@Cron4j(cron5x = "7s", name = "TimeJob")
public class TimeJob implements Runnable {
    @Override
    public void run() {
        final String m=(LocalDateTime.now().toString());
        SessionManager.websocket().getOpenSessions().forEach( ws -> {
            log.info(m);
            ws.send(m);
        });
    }
}